python practical implementation of deque